import { h, render } from 'preact'
import createStore from 'unistore'

import App from './App'

let elem = document.getElementById('app')

export const getstore = () => createStore(window.__INIT_DATA__ || {})

export const init = (store) => {
    let App = require('./components/App').default
    elem = render(<App store={store} />, document.body, root)
}

export default { init, getstore }
